var dbConfig = require('../util/dbconfig')
    //获取用户
getUser = (req, res) => {
        var sql = "select * from user";
        var sqlArr = [];
        var callBack = (err, conn) => {
            if (err) {
                console.log('连接出错！')
            } else {
                res.send({
                    status: 200,
                    msg: 'GET请求成功',
                    data: conn
                })
            }
        }

        dbConfig.sqlConnect(sql, sqlArr, callBack)
    }
    //login
postLogin = (req, res) => {
    let { user_id, user_pwd } = req.query;
    var sql = "select * from user where user_id=? and user_pwd=?";
    var sqlArr = [user_id, user_pwd]

    var callBack = (err, conn) => {
        if (err) {
            console.log('连接出错！')
        } else {
            res.send({
                status: 200,
                msg: 'POST请求成功',
                data: conn
            })
        }
    }

    dbConfig.sqlConnect(sql, sqlArr, callBack)
}
module.exports = {
    getUser,
    postLogin
}